<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="/WEB-INF/tld/framework.tld" prefix="mayi"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Admin</title>
<link rel="stylesheet"
	href="vendors/iconfonts/mdi/css/materialdesignicons.min.css">
<link rel="stylesheet" href="vendors/css/vendor.bundle.base.css">
<link rel="stylesheet" href="node_modules/jqvmap/dist/jqvmap.min.css" />
<link rel="stylesheet" href="css/style.css">
<link rel="shortcut icon" href="images/favicon.png" />
<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery-3.1.1.min.js"></script>
</head>

<body>
	<div class="container-scroller">
		<!-- partial:partials/_navbar.html -->
		<nav
			class="navbar default-layout-navbar col-lg-12 col-12 p-0 fixed-top d-flex flex-row">
		<div
			class="text-center navbar-brand-wrapper d-flex align-items-center justify-content-center">
			<a class="navbar-brand brand-logo" href="admin/toAdmin"><img
				src="images/logo.svg" alt="logo" /></a>
			<!-- 主页index地址 -->
			<a class="navbar-brand brand-logo-mini" href="admin/toAdmin"><img
				src="images/logo-mini.svg" alt="logo" /></a>
			<!-- 主页index地址 -->
		</div>
		<div class="navbar-menu-wrapper d-flex align-items-stretch">
			<ul class="navbar-nav navbar-nav-right">
				<li class="nav-item nav-profile dropdown"><a
					class="nav-link dropdown-toggle" id="profileDropdown" href="#"
					data-toggle="dropdown" aria-expanded="false">
						<div class="nav-profile-img">
							<img src="images/faces/face1.jpg" alt="image"> <span
								class="availability-status online"></span>
						</div>
						<div class="nav-profile-text">
							<p class="mb-1 text-black">${sessionScope.name }</p>
							<!--用户名  -->
						</div>
				</a>
					<div class="dropdown-menu navbar-dropdown"
						aria-labelledby="profileDropdown">
						<div class="dropdown-divider"></div>
						<a class="dropdown-item" href="login/loginOut"> <!-- 退出地址 -->
							<i class="mdi mdi-logout mr-2 text-primary"></i> Signout
						</a>
					</div></li>
				<li class="nav-item d-none d-lg-block full-screen-link"><a
					class="nav-link"> <i class="mdi mdi-fullscreen"
						id="fullscreen-button"></i>
				</a></li>
			</ul>
			<button
				class="navbar-toggler navbar-toggler-right d-lg-none align-self-center"
				type="button" data-toggle="offcanvas">
				<span class="mdi mdi-menu"></span>
			</button>
		</div>
		</nav>
		<div class="container-fluid page-body-wrapper">
			<nav class="sidebar sidebar-offcanvas" id="sidebar">
			<ul class="nav">
				<li class="nav-item nav-profile"><a href="#" class="nav-link">
						<div class="nav-profile-image">
							<img src="images/faces/face1.jpg" alt="profile"> <span
								class="login-status online"></span>
							<!--change to offline or busy as needed-->
						</div>
						<div class="nav-profile-text d-flex flex-column">
							<span class="font-weight-bold mb-2">${sessionScope.name }</span>
							<!-- 用户名 -->
						</div> <i class="mdi mdi-bookmark-check text-success nav-profile-badge"></i>
				</a></li>
				<li class="nav-item"><a class="nav-link"
					href="admin/selectBussiness"> <!-- 地址 --> <span
						class="menu-title">商户信息</span> <i
						class="mdi mdi-format-list-bulleted menu-icon"></i>
				</a></li>
				<li class="nav-item"><a class="nav-link"
					href="admin/selectUser"> <!-- 地址 --> <span class="menu-title">用户信息</span>
						<i class="mdi mdi-table-large menu-icon"></i>
				</a></li>
				<li class="nav-item"><a class="nav-link"
					href="admin/selectType"> <!-- 地址 --> <span class="menu-title">种类信息</span>
						<i class="mdi mdi-crosshairs-gps menu-icon"></i>
				</a></li>
			</ul>
			</nav>
			<!-- partial -->
			<div class="main-panel">
				<div class="content-wrapper">
					<div class="page-header">
						<h3 class="page-title">商品种类信息</h3>
					</div>
					<div class="row">
						<div class="col-lg-12 grid-margin stretch-card">
							<div class="card">
								<div class="card-body">
									<a href="admin/addTypePage"><button
											class="btn btn-gradient-primary mr-2">添加商品种类</button></a>
									<!-- 添加商品 -->
									<div class="search" align="right">
										<form id="form1" action="admin/selectType" method="post">
											<!-- 地址 -->
											种类名称 : <input type="text" name="typeName"
												value="${typeName }"> <input type="hidden"
												id="curPage" name="curPage" value="1"> <input
												type="submit" class="btn_grey" value="搜索">
										</form>
									</div>
									<table class="table table-bordered">
										<thead>
											<tr>
												<th>#</th>
												<th>商品种类</th>
												<th>商品种类简介</th>
												<th>状态</th>
												<th>操作</th>
											</tr>
										</thead>
										<tbody>
											<c:forEach items="${page.date }" var="type"
												varStatus="status">
												<tr>
													<td>${status.count }</td>
													<td>${type.typeName}</td>
													<td>${type.typeBrief}</td>
													<td><a href="${pageContext.request.contextPath}/admin/changeType?typeId=${type.typeId}"><c:if test="${type.state eq '1' }">
															<button type="button"
																class="btn btn-gradient-success btn-sm">可见</button>
														</c:if></a> <a href="${pageContext.request.contextPath}/admin/changeType?typeId=${type.typeId}"><c:if test="${type.state eq '0' }">
															<button type="button"
																class="btn btn-gradient-secondary btn-sm">不可见</button>
														</c:if></a></td>
													<td><a href="<%=path %>/admin/updateTypePage?typeId=${type.typeId}"><button
																type="button" class="btn btn-gradient-info btn-sm">修改</button></a>
													</td>
												</tr>
											</c:forEach>
										</tbody>
									</table>
									<div align="center">
										<p>
											<c:if test="${page.curPage == 1}">首页</c:if>
											<c:if test="${page.curPage > 1}">
												<a href="javascript:jump(1)">首页</a>
											</c:if>
											<c:if test="${page.curPage == 1 }">上一页</c:if>
											<c:if test="${page.curPage > 1 }">
												<a href="javascript:jump(${page.curPage-1 })">上一页</a>
											</c:if>
											<c:if test="${page.curPage == page.totalPage }">下一页</c:if>
											<c:if test="${page.curPage < page.totalPage }">
												<a href="javascript:jump(${page.curPage+1 })">下一页</a>
											</c:if>
											<c:if test="${page.curPage == page.totalPage }">末页</c:if>
											<c:if test="${page.curPage < page.totalPage }">
												<a href="javascript:jump(${page.totalPage })">末页</a>
											</c:if>
											共${page.totalPage }页 当前页${page.curPage } 总共${page.rows }条数据
										</p>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
				
			</div>
		</div>
	</div>
		<script type="text/javascript">
		//分页查询
		function jump(curPage) {
			$("#curPage").val(curPage);//修改隐藏域的页码
			//还可以进行 form的 提交的url
			//$("#form1").action = "${pageContext.request.contextPath }/user";
			//提交form表单
			$("#form1").submit();
		}
	</script>
	<script src="vendors/js/vendor.bundle.base.js"></script>
	<script src="vendors/js/vendor.bundle.addons.js"></script>
	<script src="js/off-canvas.js"></script>
	<script src="js/misc.js"></script>
</body>

</html>